<extend name="Base/common"/>
<block name="hjs">
    <script src="http://open.web.meitu.com/sources/xiuxiu.js" type="text/javascript"></script>
    <script type="text/javascript">
    window.onload=function(){
      xiuxiu.embedSWF("altContent",5,"100%","100%");
      /*第1个参数是加载编辑器div容器，第2个参数是编辑器类型，第3个参数是div容器宽，第4个参数是div容器高*/
      xiuxiu.setUploadURL("http://127.0.0.1{:U('Mtxx/uploadPicture')}");//修改为上传接收图片程序地址
      xiuxiu.setUploadType (2);
      xiuxiu.onInit = function ()
      {
        xiuxiu.loadPhoto("http://z-70.qiniudn.com/Uploads_Picture_2014-04-22_53554ad0a432e.jpg");//修改为要处理的图片url
      }
      xiuxiu.onUploadResponse = function (data)
      {
        if(data){
          window.location="{:U('Profile/index')}";
        }else{
          alert(data);
        }
      }
    }
    </script>
</block>
<block name="body">
<div class="col-sm-8">
        <!-- 标签导航 -->
        <div class="row">
            <div class="col-xs-12 profile_nav">
                <ul class="nav nav-tabs">
                  <li class="active  col-sm-offset-1"><a href="#base" data-toggle="tab">基本信息</a></li>
                  <li><a href="#avatar" data-toggle="tab">设置头像</a></li>
                  <li><a href="#password" data-toggle="tab">修改密码</a></li>
                  <li><a href="#sns" data-toggle="tab">社区绑定</a></li>
                </ul>
            </div>
        </div>
        <!-- 资料主题 -->
        <div class="row">
        <div class="tab-content">
            <!-- 基本信息 -->
          <div class="tab-pane active" id="base">
            <div class="row">
                <form class="form-horizontal text-muted base_form" action="{:U('updataProfile')}" method="post">
                  <div class="form-group">
                    <label class="col-md-4 control-label">昵称:</label>
                    <div class="col-md-4">
                      <input type="text" class="form-control" value="{$user.nickname|htmlspecialchars}"  errormsg="非法昵称" nullmsg="修改昵称" datatype="*6-20" name="nickname">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label">性别:</label>
                    <div class="col-md-4">
                          <label class="radio-inline">
                            <input type="radio" name="sex" id="sex0" value="0">女
                          </label>
                          <label class="radio-inline">
                            <input type="radio" name="sex" id="sex1" value="1">男
                          </label>
                          <label class="radio-inline">
                            <input type="radio" name="sex" id="sex2" value="2">保密
                          </label>
                          <script>
                            switch({$user.sex}){
                                case 0: $("#sex0").prop("checked", true);break;
                                case 1: $("#sex1").prop("checked",true);break;
                                default: $("#sex2").prop("checked",true);
                            }
                          </script>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label">生日:</label>
                    <div class="col-md-4">
                      <input type="text" class="form-control time" value="{$user.birthday|htmlspecialchars}" errormsg="" nullmsg="选择出生日期" datatype="*" name="birthday">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label">QQ号:</label>
                    <div class="col-md-4">
                      {$user.qq|htmlspecialchars}
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label">用户名:</label>
                    <div class="col-md-4">
                      {$user.username|htmlspecialchars}
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label">邮箱:</label>
                    <div class="col-md-4">
                      <span>{$user.email|htmlspecialchars}</span>
                    </div>
                    <a href="">更改邮箱</a>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label" >手机:</label>
                    <div class="col-md-4">
                      {$user.mobile|htmlspecialchars}
                    </div>
                    <if condition="$user['mobile']">
                        <a href="{:U('UserCenter/Index/unbindMobile')}">解除绑定</a>
                        <else/>
                        <a href="{:U('UserCenter/Index/bindMobile')}">立即绑定</a>
                    </if>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label">注册时间:</label>
                    <div class="col-md-4">
                      {$user.reg_time|time_format}
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label">积分:</label>
                    <div class="col-md-4">
                      {$user.score}
                    </div>
                  </div>


                  <div class="form-group">
                    <div class="col-md-offset-4">
                      <div class="col-md-6 controls Validform_checktip text-warning"></div>
                    </div>
                  </div>
                  <div class="form-group">
                    <div class="col-md-offset-4 controls">
                      <button type="submit" class="btn">修改基本资料</button>
                    </div>
                  </div>
                </form>
                
            </div>
          </div>

          <!-- 设置头像 -->
          <div class="tab-pane" id="avatar">
                
                <div class="col-sm-12">
                    <div class="mt_img">
                      <div id="altContent"></div>
                    </div>
                </div>
          </div>
          
          <!-- 修改密码 -->
          <div class="tab-pane" id="password">
                <form class="form-horizontal" action="{:U('changePassword')}" method="post">
                  <div class="form-group">
                    <label class="col-md-4 control-label" for="inputPassword">原密码</label>
                    <div class="col-md-4">
                      <input type="password" id="inputPassword"  class="form-control" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="old">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label" for="inputPassword">新密码</label>
                    <div class="col-md-4">
                      <input type="password" id="inputPassword"  class="form-control" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-4 control-label" for="inputPassword">确认密码</label>
                    <div class="col-md-4">
                      <input type="password" id="inputPassword" class="form-control" placeholder="请再次输入密码" recheck="password" errormsg="您两次输入的密码不一致" nullmsg="请填确认密码" datatype="*" name="repassword">
                    </div>
                  </div>
                  <div class="form-group">
                    <div class="col-md-offset-4">
                      <div class="col-md-6 controls Validform_checktip text-warning"></div>
                    </div>
                  </div>
                  <div class="form-group">
                    <div class="col-md-offset-4 controls">
                      <button type="submit" class="btn">提 交</button>
                    </div>
                  </div>
                </form>
          </div>

          <!-- 社区绑定 -->
          <div class="tab-pane" id="sns">
            
          </div>
        </div>
      </div>
</div>
</block>